//2009/09/08 10:43:40
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class OldestOne
{
public:
    string oldest(vector <string> data)
    {
        vector<pair<pair<int, int>, string > > v(data.size());
        for (int i=0; i<data.size(); i++)
        {
			v[i].first.first = 0;
			v[i].first.second = i;
            int j=0;
            while (data[i][j]==' ') j++;
            while (!isdigit(data[i][j]))
            {
                v[i].second += data[i][j];
                j++;
            }
            while (isdigit(data[i][j]))
            {
				v[i].first.first += 10 * v[i].first.first + (data[i][j] - '0');
				j++;
            }
			v[i].first.first = -v[i].first.first;
			for(j=v[i].second.size()-1; j>=0; j--) if(v[i].second.at(j) != ' ') break;
			v[i].second = v[i].second.substr(0, j+1);
        }
		sort(v.begin(), v.end());
		return v[0].second;
    }
};
